package com.globallogic.vkulyk.JaxbHandler;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;

public class CatalogCreator {

	public Object createObject() {
		ObjectFactory objectFactory = new ObjectFactory();

		Book book1 = objectFactory.createBook();
		book1.setId(new BigInteger("111"));
		book1.setName("Learning JAXB");
		book1.setISBN(new BigInteger("123445"));
		book1.setPrice("34 $");
		Authors authors = objectFactory.createAuthors();
		List<String> authorsNames = new ArrayList<String>();
		authorsNames.add("Jane Doe");
		authors.name = authorsNames;
		book1.setAuthors(authors);
		book1.setDescription("Step by step instructions for beginners");
		book1.setPublishDate("2003-01-01");

		Book book2 = objectFactory.createBook();
		book2.setId(new BigInteger("222"));
		book2.setName("Java Webservices today and Beyond");
		book2.setISBN(new BigInteger("522965"));
		book2.setPrice("29 $");
		Authors authors2 = objectFactory.createAuthors();
		List<String> authorsNames2 = new ArrayList<String>();
		authorsNames2.add("John Brown");
		authorsNames2.add("Peter T.");
		authors2.name = authorsNames2;
		book2.setAuthors(authors2);
		book2.setDescription("Information for users so that they can start using Java Web Services Developer Pack");
		book2.setPublishDate("2002-11-01");

		List<Book> booksList = new ArrayList<Book>();
		booksList.add(book1);
		booksList.add(book2);
		Books books = objectFactory.createBooks();
		books.book = booksList;

		Catalog catalog = objectFactory.createCatalog();
		catalog.setBooks(books);
		return catalog;
	}

}
